package com.chinadci.smartcommunitysystembackstage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chinadci.smartcommunitysystembackstage.entity.ScsAdmin;
import com.chinadci.smartcommunitysystembackstage.entity.ScsFeedback;
import com.chinadci.smartcommunitysystembackstage.entity.ScsNotice;
import com.chinadci.smartcommunitysystembackstage.entity.ScsUser;
import org.apache.ibatis.annotations.Many;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface ScsNoticeMapper extends BaseMapper<ScsNotice> {
    //显示所有社区公告
    @Select("select * from scs_notice where n_title like #{title}")
    @Results({
            @Result(id = true,column = "n_id",property = "nId"),
            @Result(column = "n_title",property = "nTitle"),
            @Result(column = "n_content",property = "nContent"),
            @Result(column = "n_releasetime",property = "nReleasetime"),
            @Result(column = "a_id",property = "admin",many =@Many(select = "Select"))
    })
    List<ScsNotice> Find(String title);

    @Select("select * from scs_admin where a_id=#{a_id}")
    List<ScsAdmin> Select(int id);

    //修改的时候查询社区公告
    @Select("select * from scs_notice where n_id=#{id}")
    @Results({
            @Result(id = true,column = "n_id",property = "nId"),
            @Result(column = "n_title",property = "nTitle"),
            @Result(column = "n_content",property = "nContent"),
            @Result(column = "n_releasetime",property = "nReleasetime"),
            @Result(column = "a_id",property = "admin",many =@Many(select = "Select"))
    })
    List<ScsNotice> Finds(int id);
}
